package com.example.calculator;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/calc")
@Controller
public class clacController {
    @ResponseBody
    @RequestMapping("/sum")
    public String getSum(Integer num1,Integer num2){
        return "结果:"+(num1+num2);
    }

    @ResponseBody
    @RequestMapping("/minus")
    public String getMinus(Integer num1,Integer num2){
        return "结果:"+(num1-num2);
    }

    @ResponseBody
    @RequestMapping("/multiply")
    public String getMultiply(Integer num1,Integer num2){
        return "结果:"+(num1*num2);
    }

    @ResponseBody
    @RequestMapping("/divide")
    public String getDivide(Integer num1,Integer num2){
        return "结果:"+(num1/num2);
    }
}
